<template>
	<PopupTemplate className="swiper_popup" :title="title" :type="title?1:2" :visible="visible"
		@update:visible="handleUpdate">
		<view class="width_300" :class="title?'pt_16':''">
			<u-swiper :list="list" :indicator="true" height="766rpx" :autoplay="false" indicator
				:indicatorStyle="{'text-align': 'center', 'bottom': '48rpx'}" @click="handleClick">
			</u-swiper>
		</view>
	</PopupTemplate>
</template>

<script>
	import PopupTemplate from '@/components/PopupTemplate'
	export default {
		components: {
			PopupTemplate
		},
		props: {
			title: {
				type: String,
				default: ''
			},
			visible: {
				type: Boolean,
				default: false
			},
			list: {
				type: Array,
				default: () => ([])
			}
		},
		methods: {
			handleUpdate(e) {
				this.$emit('update:visible', e)
			},
			handleClick(index) {
				let url = ''
				switch (this.list[index].jumpMethod) {
					case '1':
						url = `/pages/common/pages/richtext?id=${this.list[index].id}&banner=true`
						break;
					case '2':
						url = '/pages/goods/pages/seckill'
						break;
					case '3':
						url = '/pages/goods/pages/rush_purchase'
						break;
					case '4':
						url = '/pages/goods/pages/bargain'
						break;
					case '5':
						url = '/pages/goods/pages/group'
						break;
					case '6':
						url = '/pages/goods/pages/detail?id=' + this.list[index].productId
						break;
					case '7':
						url = '/pages/goods/pages/search?brandId=' + this.list[index].productId
						break;
					case '9':
						url = '/pages/goods/pages/integral'
						break;
					default:
						break;
				}
				if (url) {
					this.$emit('update:visible', false)
					uni.navigateTo({
						url
					})
				}
			}
		}
	}
</script>

<style>
</style>